<template>
<div>
   <ProForm ref="dialogForm" :config="addeditConfig" :echo="echo"></ProForm>
             <!-- <el-button>取消</el-button>
          <el-button type="primary" @click="confirm" color="#081F42">
            確定
          </el-button> -->
</div>
</template>

<script setup>
import { ref, watch } from 'vue' 
import {addeditConfig} from './formConfig'
const props = defineProps({
  echo:Object,
  school:Object,
  position:Object
}) 
			addeditConfig.formItems.find((e) => e.props.label =='所屬學校').options = props.school
			addeditConfig.formItems.find((e) => e.props.label =='可選學校').options = props.school
			addeditConfig.formItems.find((e) => e.props.label =='職位').options = props.position

watch(()=>props.school,(newval)=>{
			addeditConfig.formItems.find((e) => e.props.label =='所屬學校').options = newval
			addeditConfig.formItems.find((e) => e.props.label =='可選學校').options = newval
			addeditConfig.formItems.find((e) => e.props.label =='職位').options = props.position
})


const dialogForm = ref('');
const emit = defineEmits(['addeditClick'])
const DialogCofirm = (cb) => {
  dialogForm.value.submit((e) => {
    // console.log(e);
    cb(e);
   emit('addeditClick',e)
  });
};

defineExpose({
    DialogCofirm,
})

</script>

<style lang='less'  scoped>

</style>